<extend name="Base/common" />

<block name="body">
<section class="user-form user-bind" id="account">
  <div class="userinfo">
    <div class="avatar">
      <img src="{$userinfo.headimgurl}" alt="">
    </div>
    <div class="tips">账号授权成功！<br>简单设置及可使用。</div>
  </div>
  <ul class="flex-box tabs">
    <li class="current" data-args="create"><a href="javascript:;">创建新账号</a></li>
    <li data-args="bind"><a href="javascript:;">已有账号？</a></li>
  </ul>
  <div class="tab-pane in" id="create">
    <form action="{:U('User/register')}" id="Z_bind_form" method="post">
      <input type="hidden" name="oauth_type" value="{$type}">
      <input type="hidden" name="type_uid" value="{$oauth.type_uid}">
      <input type="hidden" name="oauth_token" value="{$oauth.oauth_token}">
      <input type="hidden" name="oauth_token_secret" value="{$oauth.oauth_token_secret}">
      <input type="hidden" name="avatar" value="{$user.avatar}">
      <input type="hidden" name="oauth_signature" value="{$user.signature}" >
      <label class="form-group">
        <input type="text" name="username" id="inputEmail" class="form-text Z_bind_username" placeholder="手机" ajaxurl="{:U('User/checkUsername')}" errormsg="请填写正确格式的手机" nullmsg="手机不能为空" datatype="m" value="">
      </label>
      <if condition="C('REGISTER_MOBILE_VALID') eq 1">
        <div id="Z_bind_verify" class="control-group">
          <input type="text" name="verify" id="verify" maxlength="4" placeholder="图形验证码">
          <img class="verifyimg J_reload_verify" style="width: 86px; height: 30px; position: absolute; right: 10px; top:8px;" title="点击更换" src="{:U('User/verify')}">
        </div>
      <div class="control-group">
        <input type="tel" name="randcode" class="Z_mobile_randcode" maxlength="6" placeholder="短信验证码">
        <a href="javascript:;" class="btn btn-primary btn-randcode Z_mobile_button" data-geturl="{:U('User/sendMobileCode')}">获取短信验证码</a>
      </div>
      </if>
      <label class="form-group">
        <input type="password" name="password" id="inputPassword" class="form-text Z_bind_password" placeholder="请输入密码" errormsg="密码为6-20位" nullmsg="请填写密码" datatype="*6-20" >
      </label>
      <label class="form-group">
        <input type="password" name="repassword" id="inputRepassword" class="form-text Z_bind_repassword" placeholder="请再次输入密码" errormsg="密码为6-20位" nullmsg="请填写密码" datatype="*6-20">
      </label>
      <label class="form-group">
        <button type="submit" id="Z_bind_submit" class="ui-btn ui-btn-lg ui-btn-flex ui-btn-danger">创建账号</button>
      </label>
    </form>
  </div>
  <div class="tab-pane" id="bind">
    <form action="{:U('User/bind')}" method="post">
      <input type="hidden" name="oauth_type" value="{$type}">
      <input type="hidden" name="oauth_token" value="{$oauth.oauth_token}">
      <input type="hidden" name="oauth_token_secret" value="{$oauth.oauth_token_secret}">
      <input type="hidden" name="type_uid" value="{$oauth.type_uid}">
      <input type="hidden" name="avatar" value="{$user.avatar}">
      <input type="hidden" name="oauth_signature" value="{$user.signature}">
      <label class="form-group">
        <input type="text" name="username" id="inputEmail" class="form-text" placeholder="邮箱或手机" nullmsg="请填写邮箱或手机" datatype="e|m" value="">
      </label>
      <label class="form-group">
        <input type="password" name="password" id="inputPassword"  class="form-text" placeholder="请输入密码"  errormsg="密码为6-20位" nullmsg="请填写密码" datatype="*6-20">
      </label>
      <label class="form-group">
        <button type="submit" class="ui-btn ui-btn-lg ui-btn-flex ui-btn-danger">绑 定</button>
      </label>
    </form>
  </div>
</section>
</block>

<block name="script">
  <script type="text/javascript">
    (function(){
      user.init();
      user.send_mobilecode('register');
    })();
  </script>
</block>
